<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>社交活动平台 - 活动详情</title>
    <style>
        /* 重置样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        /* 容器样式 */
        .container {
            max-width: 480px;
            margin: 0 auto;
            background-color: #fff;
            min-height: 100vh;
        }

        /* 头部导航 */
        .header {
            position: sticky;
            top: 0;
            background-color: white;
            padding: 16px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            z-index: 100;
        }

        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .back-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #333;
        }

        .header-title {
            font-size: 18px;
            font-weight: bold;
            flex-grow: 1;
            text-align: center;
        }

        .action-btn {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #333;
        }

        /* 活动封面 */
        .activity-cover {
            width: 100%;
            height: 240px;
            object-fit: cover;
        }

        /* 活动基本信息 */
        .activity-info {
            padding: 20px;
        }

        .activity-title {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 12px;
            color: #333;
        }

        .activity-meta {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .meta-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            color: #666;
        }

        .meta-icon {
            font-size: 18px;
        }

        /* 社交温度标签 */
        .activity-temperature {
            display: inline-block;
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 13px;
            font-weight: bold;
            margin-bottom: 20px;
        }

        .temperature-hot {
            background-color: #ffebee;
            color: #e53935;
        }

        .temperature-warm {
            background-color: #fff8e1;
            color: #ff8f00;
        }

        .temperature-calm {
            background-color: #e8f5e9;
            color: #388e3c;
        }

        /* 活动标签 */
        .activity-tags {
            display: flex;
            gap: 10px;
            margin-bottom: 24px;
            flex-wrap: wrap;
        }

        .tag {
            background-color: #f0f8ff;
            color: #45b7d1;
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 13px;
        }

        /* 活动描述 */
        .activity-description {
            margin-bottom: 24px;
        }

        .description-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 12px;
            color: #333;
        }

        .description-content {
            font-size: 16px;
            line-height: 1.7;
            color: #555;
        }

        /* 发起人信息 */
        .organizer-section {
            margin-bottom: 24px;
            padding: 16px;
            background-color: #f9f9f9;
            border-radius: 12px;
        }

        .organizer-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 16px;
            color: #333;
        }

        .organizer-info {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .organizer-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: #e0e0e0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
        }

        .organizer-details {
            flex-grow: 1;
        }

        .organizer-name {
            font-weight: bold;
            margin-bottom: 4px;
        }

        .organizer-stats {
            display: flex;
            gap: 12px;
            font-size: 13px;
            color: #666;
        }

        .stat-item {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        /* 参与统计 */
        .participants-section {
            margin-bottom: 24px;
        }

        .section-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 16px;
            color: #333;
        }

        .participants-stats {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .stats-number {
            font-size: 20px;
            font-weight: bold;
            color: #ff6b35;
        }

        .stats-text {
            font-size: 14px;
            color: #666;
        }

        .participants-list {
            display: flex;
            gap: 10px;
            margin-bottom: 24px;
            overflow-x: auto;
            padding-bottom: 8px;
        }

        .participant-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #e0e0e0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
        }

        /* 报名按钮 */
        .register-section {
            padding: 16px;
            background-color: white;
            border-top: 1px solid #eee;
            position: sticky;
            bottom: 0;
            z-index: 99;
        }

        .register-btn {
            width: 100%;
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
            border: none;
            padding: 16px;
            border-radius: 24px;
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
        }

        .register-btn:hover {
            transform: scale(1.02);
            box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
        }

        .register-btn.registered {
            background: #9e9e9e;
            cursor: default;
        }

        .register-btn.registered:hover {
            transform: none;
            box-shadow: 0 4px 12px rgba(158, 158, 158, 0.3);
        }

        /* 活动评论区 */
        .comments-section {
            padding: 20px;
            border-top: 1px solid #eee;
        }

        .comments-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .comments-title {
            font-size: 18px;
            font-weight: bold;
        }

        .comments-count {
            color: #666;
            font-size: 14px;
        }

        .comment-item {
            display: flex;
            gap: 12px;
            margin-bottom: 20px;
        }

        .comment-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #e0e0e0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
        }

        .comment-content {
            flex-grow: 1;
        }

        .comment-user {
            font-weight: bold;
            margin-bottom: 4px;
            color: #333;
        }

        .comment-text {
            font-size: 15px;
            color: #555;
            margin-bottom: 8px;
        }

        .comment-time {
            font-size: 12px;
            color: #999;
        }

        /* 发表评论区域 */
        .comment-input-area {
            display: flex;
            gap: 12px;
            padding-top: 20px;
            border-top: 1px solid #eee;
        }

        .comment-input {
            flex-grow: 1;
            padding: 12px 16px;
            border-radius: 24px;
            border: 1px solid #ddd;
            font-size: 15px;
            outline: none;
        }

        .comment-input:focus {
            border-color: #ff6b35;
        }

        .send-btn {
            background: linear-gradient(135deg, #45b7d1 0%, #2c8cb9 100%);
            color: white;
            border: none;
            width: 48px;
            height: 48px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .send-btn:hover {
            transform: scale(1.05);
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: white;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            z-index: 100;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #9e9e9e;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .nav-item.active {
            color: #ff6b35;
        }

        .nav-icon {
            font-size: 20px;
            margin-bottom: 4px;
        }

        /* 加载动画 */
        .loading {
            text-align: center;
            padding: 40px 20px;
        }

        .spinner {
            width: 36px;
            height: 36px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #ff6b35;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: white;
            border-radius: 16px;
            width: 85%;
            max-width: 320px;
            padding: 24px;
            text-align: center;
            transform: translateY(20px);
            opacity: 0;
            transition: all 0.3s ease;
        }

        .modal.show {
            transform: translateY(0);
            opacity: 1;
        }

        .modal-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 16px;
            color: #333;
        }

        .modal-message {
            margin-bottom: 24px;
            color: #666;
            line-height: 1.6;
        }

        .modal-actions {
            display: flex;
            gap: 12px;
        }

        .modal-btn {
            flex: 1;
            padding: 12px;
            border-radius: 8px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .cancel-btn {
            background-color: #f5f5f5;
            color: #666;
        }

        .confirm-btn {
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
        }

        /* 响应式适配 */
        @media (max-width: 480px) {
            .activity-cover {
                height: 200px;
            }
            
            .header-content {
                padding-top: 4px;
            }
            
            .activity-title {
                font-size: 20px;
            }
        }

        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .activity-info, 
        .organizer-section,
        .participants-section,
        .comments-section {
            animation: fadeInUp 0.6s ease forwards;
        }

        /* 按钮状态动画 */
        .register-btn {
            animation: buttonPulse 2s infinite;
        }

        @keyframes buttonPulse {
            0% { box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3); }
            50% { box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4); }
            100% { box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3); }
        }

        /* 活动类型标签颜色 */
        .tag-sport { background-color: #e3f2fd; color: #1976d2; }
        .tag-learning { background-color: #f3e5f5; color: #7b1fa2; }
        .tag-social { background-color: #e8f5e9; color: #388e3c; }
        .tag-food { background-color: #fff3e0; color: #f57c00; }
        .tag-culture { background-color: #fce4ec; color: #c2185b; }
        .tag-outdoor { background-color: #e0f2f1; color: #00796b; }
    </style>
</head>
<body>
    <div class="container">
        <!-- 头部导航 -->
        <header class="header">
            <div class="header-content">
                <button class="back-btn" id="backBtn">←</button>
                <div class="header-title">活动详情</div>
                <button class="action-btn" id="shareBtn">分享</button>
            </div>
        </header>

        <!-- 活动封面 -->
        <img src="https://images.unsplash.com/photo-1501854140801-50d01698950b?w=400&h=240&fit=crop" alt="户外徒步活动" class="activity-cover">

        <!-- 活动信息 -->
        <div class="activity-info">
            <h1 class="activity-title">周末户外徒步活动</h1>
            
            <div class="activity-meta">
                <div class="meta-item">
                    <span class="meta-icon">📍</span>
                    <span>城市公园</span>
                </div>
                <div class="meta-item">
                    <span class="meta-icon">⏰</span>
                    <span>周六 14:00 - 17:00</span>
                </div>
                <div class="meta-item">
                    <span class="meta-icon">👥</span>
                    <span>限15人参与</span>
                </div>
            </div>

            <div class="activity-temperature temperature-hot">🔥 热门活跃</div>
            
            <div class="activity-tags">
                <span class="tag tag-sport">运动</span>
                <span class="tag tag-outdoor">户外</span>
            </div>

            <!-- 活动描述 -->
            <div class="activity-description">
                <h3 class="description-title">活动介绍</h3>
                <p class="description-content">
                    这是一次轻松愉快的户外徒步活动，我们将沿着城市公园的自然步道进行探索。
                    活动全程约3小时，适合所有年龄段的朋友参加。我们会提供基础的徒步装备，
                    以及饮用水和简单的零食补给。活动过程中大家可以相互交流，结识新朋友，
                    享受大自然的美好时光。
                </p>
            </div>

            <!-- 发起人信息 -->
            <div class="organizer-section">
                <h3 class="organizer-title">发起人</h3>
                <div class="organizer-info">
                    <div class="organizer-avatar">👤</div>
                    <div class="organizer-details">
                        <div class="organizer-name">张小明</div>
                        <div class="organizer-stats">
                            <span class="stat-item">活动发起: 12次</span>
                            <span class="stat-item">参与次数: 8次</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 参与统计 -->
            <div class="participants-section">
                <h3 class="section-title">参与情况</h3>
                
                <div class="participants-stats">
                    <div>
                        <div class="stats-number">12</div>
                        <div class="stats-text">已报名</div>
                    </div>
                    <div>
                        <div class="stats-number">3</div>
                        <div class="stats-text">剩余名额</div>
                    </div>
                </div>

                <h4 class="section-title">参与成员</h4>
                <div class="participants-list">
                    <div class="participant-avatar">👤</div>
                    <div class="participant-avatar">👥</div>
                    <div class="participant-avatar">👨‍👩‍👧</div>
                    <div class="participant-avatar">🤖</div>
                    <div class="participant-avatar">🌟</div>
                    <div class="participant-avatar">🎉</div>
                </div>
            </div>

            <!-- 评论区 -->
            <div class="comments-section">
                <div class="comments-header">
                    <h3 class="comments-title">评论</h3>
                    <div class="comments-count">12条评论</div>
                </div>

                <!-- 评论项 -->
                <div class="comment-item">
                    <div class="comment-avatar">👤</div>
                    <div class="comment-content">
                        <div class="comment-user">李小红</div>
                        <p class="comment-text">这个活动看起来很棒！我已经报名了，期待和大家见面。</p>
                        <div class="comment-time">2小时前</div>
                    </div>
                </div>

                <div class="comment-item">
                    <div class="comment-avatar">👥</div>
                    <div class="comment-content">
                        <div class="comment-user">王大力</div>
                        <p class="comment-text">户外徒步是很好的锻炼方式，希望天气不要太热！</p>
                        <div class="comment-time">1小时前</div>
                    </div>
                </div>

                <div class="comment-item">
                    <div class="comment-avatar">👨‍👩‍👧</div>
                    <div class="comment-content">
                        <div class="comment-user">刘小美</div>
                        <p class="comment-text">太棒了！终于有适合家庭参加的活动了，可以和孩子一起体验。</p>
                        <div class="comment-time">30分钟前</div>
                    </div>
                </div>

                <!-- 发表评论 -->
                <div class="comment-input-area">
                    <input type="text" class="comment-input" placeholder="说点什么吧...">
                    <button class="send-btn">➤</button>
                </div>
            </div>

            <!-- 报名按钮 -->
            <div class="register-section">
                <button class="register-btn" id="registerBtn">报名参加</button>
            </div>
        </div>

        <!-- 底部导航 -->
        <nav class="bottom-nav">
            <div class="nav-item" data-page="home">
                <span class="nav-icon">🏠</span>
                <span>首页</span>
            </div>
            <div class="nav-item" data-page="search">
                <span class="nav-icon">🔍</span>
                <span>搜索</span>
            </div>
            <div class="nav-item" data-page="publish">
                <span class="nav-icon">➕</span>
                <span>发布</span>
            </div>
            <div class="nav-item active" data-page="profile">
                <span class="nav-icon">👤</span>
                <span>我的</span>
            </div>
        </nav>

        <!-- 报名确认弹窗 -->
        <div class="modal" id="registerModal">
            <div class="modal-content">
                <h3 class="modal-title">确认报名</h3>
                <p class="modal-message" id="modalMessage">
                    您确定要报名参加这个活动吗？<br>
                    活动时间：周六 14:00 - 17:00<br>
                    活动地点：城市公园
                </p>
                <div class="modal-actions">
                    <button class="modal-btn cancel-btn" id="cancelBtn">取消</button>
                    <button class="modal-btn confirm-btn" id="confirmBtn">确认报名</button>
                </div>
            </div>
        </div>

        <!-- 加载状态 -->
        <div class="loading" id="loadingIndicator">
            <div class="spinner"></div>
            <p>加载中...</p>
        </div>

        <!-- 通知 Toast -->
        <div id="toast" style="display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #4caf50; color: white; padding: 12px 24px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1001;"></div>
    </div>

    <script>
        // 全局变量
        let currentActivityId = '1';
        let currentUserRegistered = false;

        // 初始化
        document.addEventListener('DOMContentLoaded', function() {
            initEventListeners();
            simulateLoading();
            
            // 模拟已报名状态
            setTimeout(() => {
                const registerBtn = document.getElementById('registerBtn');
                if (currentUserRegistered) {
                    registerBtn.textContent = '已报名';
                    registerBtn.classList.add('registered');
                }
            }, 1000);
        });

        // 初始化事件监听器
        function initEventListeners() {
            // 返回按钮
            document.getElementById('backBtn').addEventListener('click', function() {
                window.history.back();
            });

            // 分享按钮
            document.getElementById('shareBtn').addEventListener('click', function() {
                showSuccessToast('分享功能即将上线！');
            });

            // 报名按钮
            document.getElementById('registerBtn').addEventListener('click', function() {
                if (this.classList.contains('registered')) {
                    alert('您已经报名了这个活动');
                    return;
                }
                
                // 显示确认弹窗
                const modal = document.getElementById('registerModal');
                const message = document.getElementById('modalMessage');
                
                // 动态设置消息内容
                message.innerHTML = `
                    您确定要报名参加这个活动吗？<br>
                    活动时间：周六 14:00 - 17:00<br>
                    活动地点：城市公园
                `;
                
                modal.classList.add('show');
            });

            // 弹窗确认按钮
            document.getElementById('confirmBtn').addEventListener('click', function() {
                // 模拟报名成功
                const registerBtn = document.getElementById('registerBtn');
                registerBtn.textContent = '已报名';
                registerBtn.classList.add('registered');
                
                // 标记为已报名
                currentUserRegistered = true;
                
                // 显示成功提示
                showSuccessToast('报名成功！');
                
                closeRegisterModal();
            });

            // 弹窗取消按钮
            document.getElementById('cancelBtn').addEventListener('click', closeRegisterModal);

            // 弹窗背景点击关闭
            document.getElementById('registerModal').addEventListener('click', function(e) {
                if (e.target === this) {
                    closeRegisterModal();
                }
            });

            // 底部导航切换
            const navItems = document.querySelectorAll('.nav-item');
            navItems.forEach(item => {
                item.addEventListener('click', function() {
                    // 移除所有激活状态
                    navItems.forEach(i => i.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                    
                    const page = this.dataset.page;
                    handleNavigation(page);
                });
            });

            // 评论发送
            const sendBtn = document.querySelector('.send-btn');
            const commentInput = document.querySelector('.comment-input');
            
            sendBtn.addEventListener('click', function() {
                const commentText = commentInput.value.trim();
                if (commentText) {
                    addComment(commentText);
                    commentInput.value = '';
                }
            });

            // 回车发送评论
            commentInput.addEventListener('keypress', function(e) {
                if (e.key === 'Enter') {
                    const commentText = this.value.trim();
                    if (commentText) {
                        addComment(commentText);
                        this.value = '';
                    }
                }
            });

            // 模拟加载更多评论
            const commentsSection = document.querySelector('.comments-section');
            let commentCount = 3;
            
            // 模拟评论加载
            setTimeout(() => {
                addMoreComments();
            }, 2000);
        }

        // 关闭报名弹窗
        function closeRegisterModal() {
            const modal = document.getElementById('registerModal');
            modal.classList.remove('show');
        }

        // 处理导航切换
        function handleNavigation(page) {
            switch(page) {
                case 'home':
                    alert('跳转到首页');
                    break;
                case 'search':
                    alert('跳转到搜索页面');
                    break;
                case 'publish':
                    alert('跳转到发布页面');
                    break;
                case 'profile':
                    // 个人中心无需特殊处理
                    break;
            }
        }

        // 显示加载状态
        function showLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'block';
        }

        // 隐藏加载状态
        function hideLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'none';
        }

        // 模拟加载效果
        function simulateLoading() {
            showLoading();
            setTimeout(() => {
                hideLoading();
            }, 1500);
        }

        // 显示成功提示
        function showSuccessToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.style.display = 'block';
            
            // 3秒后自动隐藏
            setTimeout(() => {
                toast.style.display = 'none';
            }, 3000);
        }

        // 添加评论
        function addComment(text) {
            const commentsSection = document.querySelector('.comments-section');
            const commentList = commentsSection.querySelector('.comment-item:last-child').parentElement;
            
            // 创建新的评论元素
            const newComment = document.createElement('div');
            newComment.className = 'comment-item';
            newComment.innerHTML = `
                <div class="comment-avatar">👤</div>
                <div class="comment-content">
                    <div class="comment-user">我</div>
                    <p class="comment-text">${text}</p>
                    <div class="comment-time">刚刚</div>
                </div>
            `;
            
            // 插入到评论列表开头
            commentsSection.insertBefore(newComment, document.querySelector('.comment-input-area'));
            
            // 滚动到底部
            commentsSection.scrollTop = commentsSection.scrollHeight;
        }

        // 添加更多评论（模拟）
        function addMoreComments() {
            const commentsSection = document.querySelector('.comments-section');
            const commentList = commentsSection.querySelector('.comment-item:last-child').parentElement;
            
            // 模拟添加更多评论
            const moreComments = [
                { user: '赵小花', text: '期待这次活动，好久没户外运动了！' },
                { user: '钱大伟', text: '活动组织很用心，期待和大家见面！' },
                { user: '孙小丽', text: '可以带上相机记录美好时光吗？' }
            ];
            
            moreComments.forEach(comment => {
                const newComment = document.createElement('div');
                newComment.className = 'comment-item';
                newComment.innerHTML = `
                    <div class="comment-avatar">👤</div>
                    <div class="comment-content">
                        <div class="comment-user">${comment.user}</div>
                        <p class="comment-text">${comment.text}</p>
                        <div class="comment-time">10分钟前</div>
                    </div>
                `;
                
                commentsSection.insertBefore(newComment, document.querySelector('.comment-input-area'));
            });
        }

        // 添加触摸反馈效果
        const buttons = document.querySelectorAll('button');
        buttons.forEach(button => {
            button.addEventListener('touchstart', function() {
                this.style.transform = 'scale(0.95)';
            });
            
            button.addEventListener('touchend', function() {
                this.style.transform = 'scale(1)';
            });
        });

        // 添加页面滚动效果
        let lastScrollTop = 0;
        window.addEventListener('scroll', function() {
            const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
            
            // 隐藏/显示底部导航
            const bottomNav = document.querySelector('.bottom-nav');
            if (scrollTop > lastScrollTop && scrollTop > 100) {
                bottomNav.style.transform = 'translateY(100%)';
            } else {
                bottomNav.style.transform = 'translateY(0)';
            }
            
            lastScrollTop = scrollTop;
        });

        // 添加返回顶部功能
        window.addEventListener('scroll', function() {
            if (window.pageYOffset > 300) {
                // 可以添加返回顶部按钮
            }
        });
    </script>
</body>
</html>
